package com.scopionstudio.adapter;

import com.scopionstudio.bean.Variables;
import com.scopionstudio.newpaper.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class PaperAdapter extends ArrayAdapter<String> {

	
	// old
	private Context context;
	private String[] papers;
	
	public PaperAdapter(Context context, int textViewResourceId,
			String[] papers) {
		super(context, textViewResourceId, papers);
		this.context = context;
		this.papers = papers;
	}	

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.activity_main, parent, false);
		ImageView imvIcon = (ImageView) rowView.findViewById(R.id.imvIcon);
		TextView tvPaprt = (TextView) rowView.findViewById(R.id.tvHello);
		imvIcon.setImageResource(Variables.ICONS[position]);
		tvPaprt.setText(papers[position]);
		return rowView;
	}

}

